/*
 *	CHANGE LOG
 *
 *  01.03.07
 *  
 *      11/30/2009 - DW - Closed the data readers when connections are made to the db. 
 *
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Framework;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using System.Data;

namespace ITCrossing
{
    public partial class itcMetaPost_View : PortalModuleBase, IActionable
    {

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
			Load +=new EventHandler(Page_Load);
        }

        #region IActionable Members

        public DotNetNuke.Entities.Modules.Actions.ModuleActionCollection ModuleActions
        {
            get
			{
				ModuleActionCollection actions = new ModuleActionCollection();
				// Admin
				actions.Add(GetNextActionID(), Localization.GetString("Admin.Text", this.LocalResourceFile),
					"ContentOptions.Action", "", "", Globals.NavigateURL(TabId, "Admin","mid=" + ModuleId), false, DotNetNuke.Security.SecurityAccessLevel.View,
					 true, false);
				
                return actions;
            }

        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
		{
			if (AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
            }
            if (!Page.IsPostBack)
			{

				# region Old Code to Retrieve the URL for Commmunity Edition (Left for Reference)
				//// Retrieve the upload URL from the modules settings
				//string sSQL =
				//    "SELECT * FROM {databaseOwner}{objectQualifier}itcMetaPost WHERE ItemId = 1";
				//string sURL = null;
				//IDataReader dr =
				//    (IDataReader)DotNetNuke.Data.DataProvider.Instance().ExecuteSQL(sSQL);
				//while (dr.Read())
				//{
				//    sURL = dr["URL"].ToString() + "";
				//}

				//if (sURL != null)
				//{
				//    lblUploadUrlValue.Text = sURL;
				//}
				# endregion

			}

        	ContainerControl.Visible = (UserInfo.IsSuperUser) ? true : false;
				//(IsEditable) ? true : false;
			

			# region Old Code Left For Reference
			//// This code was added to the page to test the ability to insert the link tag WLW needs
			//// in order to pick up the manifest file.  A better solution was discovered which is 
			//// now in metaPostRedirect.aspx.
			//// Try to load the WLW manifest file into the page
			//PlaceHolder plcCSS = (PlaceHolder)Page.FindControl("CSS");
			//HtmlGenericControl link = new HtmlGenericControl("Link");
			//link.Attributes.Add("rel", "wlwmanifest");
			//link.Attributes.Add("type", "application/wlwmanifest+xml");
			//link.Attributes.Add("href", DotNetNuke.Common.Globals.ApplicationPath + "/wlwmanifest.xml");
			//link.Visible = true;
			//plcCSS.Controls.Add(link);

			//this.ContainerControl.Visible = false;
			# endregion
        }
    }
}